package cn.xiaobai.captcha.rest;

import cn.xiaobai.captcha.server.CaptchaGeneralAdapterServer;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author yangdaji
 * @version 1.0
 * @Description:
 * @date 22-3-21 下午 10:38
 */
@Slf4j
@RestController
@RequestMapping
public class CaptchaRest {


    @Autowired(required = false)
    private CaptchaGeneralAdapterServer createGeneral;

    @RequestMapping(value = "/captcha/{unique}", method = RequestMethod.GET)
    public void getImage(@PathVariable("unique") String unique) {
        if (createGeneral != null) {
            createGeneral.createGeneral(unique);
            //key: cache_key(缓存key),cache_value(缓存值), value: cache:api:captcha:localhost:string,验证码
        }
    }
}
